home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / R / RCMD Mover.cpt / Tips on using RCMD's! < prev    next >
Text File  |  1989-12-29  |  5KB  |  135 lines

  1. Tips on using RCMD's...
  2.  
  3. by Robert A. Daniel
  4. GEnie: B.DANIEL
  5. _________________________________________________
  6.  
  7. What are RCMD's?
  8.  
  9. An RCMD (pronounced "are-command") allows adding extra features to White Knight
  10. in the same way that an XCMD adds features to HyperCard.  RCMD's can either
  11. be a complete stand-alone utility such as "ProcEdit", a procedure editor that 
  12. is self-contained and runs its own environment or an RCMD can be a function 
  13. to the procedure language such as "Zero Out", a function that is used within 
  14. your procedure to change variables to zero.  In effect, "Zero Out" is a WK 
  15. procedure command similar to ERASE.
  16.  
  17.  
  18. Stand-alone RCMD's are usually contained in their own procedure. To use the 
  19. RCMD, you would call it with the NEST command.  
  20.  
  21. RCMD Functions that add commands to the procedure language can be copied 
  22. into your procedure using "ResEdit" or a utility called "RCMD Mover" 
  23. (available for free in the FreeSoft Libraries on GEnie).
  24.  
  25. _________________________________________________
  26.  
  27. How to use RCMD's in your procedures.
  28.  
  29. There are 2 methods to call RCMD's.
  30.  
  31. Method 1:
  32. A precompiled procedure containing an RCMD can be called from your own
  33. procedure by using the NEST command.
  34.  
  35. Example:
  36. NEST :Sound Player.PROC
  37.  
  38. The : in front of the file name is used when the procedure is in the same
  39. folder as WK.  After the procedure completes, execution will return to your 
  40. procedure.
  41.  
  42. This method is the standard way to call an RCMD but Method 2 is more direct
  43. because the RCMD can be in the same file as your procedure thus execute
  44. without branching to other procedures.
  45.  
  46. _________________
  47.  
  48. Method 2:
  49.  
  50. Before getting into Method 2, you need to be aware that this method involves
  51. copying someone elses work into your procedure.  If your use of the RCMD is
  52. for more than just personal use, you may be infringing on the copyright
  53. of the RCMD.  If the RCMD is NOT public domain, you may need permission
  54. from the author to use it.
  55.  
  56. In an RCMD procedure file, there is a resource identified by the
  57. type 'RCMD' that is called by using White Knight's RCMD procedure command.
  58. If this sounds confusing then read on...
  59.  
  60. Use the included RCMD procedure "Sound Player" which will play 'snd' 
  61. sounds in your procedures.  If you open this procedure with ResEdit,
  62. you'll see a resource labeled 'RCMD'.  There are also resources labeled 'snd'
  63. in the file.  If you open the RCMD you'll see the ID number 299.  This is the
  64. number that will be used in your procedure to call the RCMD.  If you copy the 
  65. RCMD to a procedure that you have created, you can then call it using 
  66. the RCMD command followed by the ID number:
  67.  
  68. RCMD 1,299
  69.  
  70. See the RCMD procedure syntax at the end of this document.
  71.  
  72. If the RCMD procedure contains windows, sounds, or other resources, you'll
  73. need to copy those also.  The "RCMD Mover" utility simplifies copying all 
  74. resources or just the RCMD itself.  In the case of the "Sound Player", you
  75. may want to copy All Resources if you want to play the sounds included.
  76. Otherwise, you would copy 'snd's from other files into your procedure.
  77.  
  78. _________________________________________________
  79.  
  80. Questions and Answers about RCMDs:
  81.  
  82. Q: How do I know when to copy All Resources or just the RCMD?
  83.  
  84. A: If you don't know what each resource means, then you should copy all of
  85.    them.  Some cases, you may want to include your own resources.
  86.  
  87. _________________
  88.  
  89. Q: Should I copy the resources into my source code of the procedure or in my
  90.    compiled procedure file?
  91.  
  92. A: You should copy the resources into your source code.  When WK compiles
  93.    your source code, it will automically copy the RCMD's along with any other
  94.    resources into the compiled procedure.
  95.  
  96. _________________
  97.  
  98. Q: How many RCMD's can I have in a procedure?
  99.  
  100. A: You can copy as many RCMD's as you want in a single procedure as long as 
  101.    each RCMD is identified with a unique ID number.  If two RCMD's have the 
  102.    same ID number, you can simply change one of the ID's in ResEdit using 
  103.    Get Info.
  104.  
  105.  
  106. _________________________________________________
  107.  
  108. RCMD Syntax (from the WK Development Kit Documentation)
  109.  
  110. RCMD num_exp1,num_exp2
  111. Description: This command executes the RCMD whose resource ID number is 
  112. contained in num_exp2.  The RCMD itself is contained in the resource fork of the 
  113. Procedure file.  The parameter num_exp1 will be either 0 (zero) or 1 (one).
  114. If the RCMD opens any windows or installs any menus, it must pass zero for 
  115. num_exp1.  This tells White Knight to close its windows and deinstall its menus 
  116. before executing the RCMD.  This is necessary because it would be impossible to 
  117. update or activate/deactivate any of White Knight's windows from within the 
  118. RCMD, and your RCMD would not know the present state of any of White Knight's 
  119. menus.  When the RCMD completes, White Knight's windows and menus are 
  120. redisplayed as before.  If your RCMD does not require any user input/output and 
  121. does not do any drawing, you can pass a 1 for num_exp1 and the RCMD will be 
  122. quite transparent to the user.
  123.  
  124. To Summarize;
  125.   num_exp1 should a zero (0) or one (1). Zero is used if the RCMD opens a
  126.   window or uses menus.  One is used if the RCMD runs in the backround and
  127.   doesn't effect the WK window or menus.
  128.  
  129.   num_exp2 is the ID number of the RCMD resource
  130.  
  131. _________________________________________________
  132.  
  133. Bob Daniel
  134. GEnie Mail: B.DANIEL
  135. AT&T Mail: attmail!cikpc!bob